﻿using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
using System.Xml.Serialization;

namespace MazeWars
{
    public class Tile
    {
        
        Vector2 pos;
        int type;
        Rectangle srcRect;

        public Tile()
        {
            pos = new Vector2(0, 0);
            type = 0;
            srcRect = new Rectangle(0, 0, 64, 64);
        }

        public Tile(Vector2 vec, int t)
        {
            pos = vec;
            type = t;
            srcRect = new Rectangle(0, 0, 64, 64);
        }

        public Tile(Vector2 vec, int t, Rectangle rect)
        {
            pos = vec;
            type = t;
            srcRect = rect;
        }

        [XmlAttribute("type")]
        public int Type
        {
            set
            {
                type = value;
            }
            get
            {
                return type;
            }
        }

        [XmlElement("srcrect", typeof(Rectangle))]
        public Rectangle SrcRect
        {
            set
            {
                srcRect = value;
            }
            get
            {
                return srcRect;
            }
        }

        [XmlElement("position", typeof(Vector2))]
        public Vector2 Pos
        {
            set
            {
                pos = value;
            }
            get
            {
                return pos;
            }
        }

        [XmlIgnore]
        public float X
        {
            set
            {
                pos.X = value;
            }
            get
            {
                return pos.X;
            }
        }

        [XmlIgnore]
        public float Y
        {
            set
            {
                pos.Y = value;
            }
            get
            {
                return pos.Y;
            }
        }
    }//End of class Tile
}
